package org.example.controller;

import jakarta.annotation.Resource;
import org.example.bean.Seckill;
import org.example.service.SeckillService;
import org.example.util.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther:Liu
 * @Testname:SeckillController
 * @Date:2025/8/28 12:50
 */
@RestController
@RequestMapping("/seckill")
public class SeckillController {

    @Resource
    private SeckillService seckillService;

    @PostMapping("/add")
    JsonResult addSeckill(Seckill seckill) {
        return seckillService.addSeckill(seckill);
    }

    @GetMapping("/getAll")
    JsonResult getAllSeckill() {
        return seckillService.findAllSeckill();
    }

    @GetMapping("/get")
    JsonResult getSeckill() {
        return seckillService.find();
    }
}
